/* Copyright 2013 The Chromium Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file. */

/* Derived from /ui/webui/resources/css/tree.css. */

tree {
  display: block;
  outline: none;
  overflow: auto;
}

.tree-item > .tree-row {
  cursor: default;
  position: relative;
  user-select: none;
  white-space: nowrap;
}

/* All .tree-row > .file-row > ... rules are files-ng specific. */
.tree-row > .file-row > .expand-icon {
  -webkit-mask-image: url(../images/files/ui/sort_desc.svg);
  -webkit-mask-position: center;
  -webkit-mask-repeat: no-repeat;
  background-color: currentColor;
  position: relative;
  transform: rotate(-90deg);
  transition: all 150ms;
  vertical-align: top;
}

html[dir=rtl] .tree-row > .expand-icon,
html[dir=rtl] .tree-row > .file-row > .expand-icon {
  transform: rotate(90deg);
}

.tree-item[expanded] > .tree-row > .expand-icon,
.tree-item[expanded] > .tree-row > .file-row > .expand-icon {
  transform: rotate(0);
}

.tree-row > .expand-icon,
.tree-row > .file-row > .expand-icon {
  visibility: hidden;
}

.tree-row[may-have-children] > .expand-icon,
.tree-row[may-have-children] > .file-row > .expand-icon {
  visibility: visible;
}

.tree-row[has-children=false] > .expand-icon,
.tree-row[has-children=false] > .file-row > .expand-icon {
  visibility: hidden;
}

.tree-row > .file-row > .item-icon[use-generic-provided-icon] {
  -webkit-mask-image: url(../images/files/ui/filetype_placeholder_generic.svg);
  filter: none !important;
}

.tree-row[selected] {
  z-index: 2;
}

.tree-children[expanded] {
  display: block;
}

.tree-children {
  display: none;
}

.tree-label {
  white-space: pre;
}

/* We need to ensure that even empty labels take up space */
.tree-label:empty::after {
  content: ' ';
  white-space: pre;
}

.tree-rename > .tree-row > .tree-label,
.tree-rename > .tree-row > .file-row > .tree-label {
  -webkit-user-modify: read-write-plaintext-only;
  user-select: auto;
}
